package me.softwareengineer.guice.rendering.listener;

import java.util.Map;

import me.softwareengineer.guice.rendering.domain.VerbatimElement;

/**
 * Called to notify about not-interpreted in-line sequence of characters which
 * should be represented in the final text "as is". For instance, javascript
 * code in XHTML document
 * 
 * @author yadtahir
 * @see VerbatimElement
 * @see OnElementEvent <pre>
 * This class is thread-safe and immutable.
 * </pre>
 */
public class OnVerbatimEvent extends EventHasProperties implements
		OnElementEvent {
	/**
	 * The string to protect from rendering.
	 */
	private String protectedString;

	/**
	 * If true the element is located in a inline content (like paragraph,
	 * etc.).
	 */
	private boolean isInline;

	/**
	 * Creates an on verbatim event
	 * 
	 * @param properties
	 *            the properties of the element
	 * @param isInline
	 *            true if the map is located in a inline content
	 * @param protectedString
	 *            the protected string of the verbatim element. For more info,
	 *            check {@link VerbatimElement#getProtectedString()}
	 * 
	 */
	public OnVerbatimEvent(String protectedString,
			Map<String, String> properties, boolean isInline) {
		super(properties);
		this.isInline = isInline;
		this.protectedString = protectedString;
	}

	/**
	 * @return the string to protect from rendering
	 */
	public String getProtectedString() {
		return this.protectedString;
	}

	/**
	 * @return if true the macro is located in a inline content (like paragraph,
	 *         etc.).
	 */
	public boolean isInline() {
		return this.isInline;
	}

}
